@import 'ctl_base_ui/colors';
@import 'ctl_base_ui/mixins';
@import 'ctl_base_ui/icons';
@import 'panamax/buttons';

body#search_flow main:after {
  display: block;
  content: '';
  clear: both;
}

[class$='-results'] {
  margin-bottom: 2.2em;
}

.template-details-dialog {
  position: absolute;
  top: 50px;
  z-index: 999;

  .ui-dialog-content {
    margin-bottom: 72px;
    box-sizing: border-box;
    overflow-y: scroll;
  }

  .ui-dialog-buttonpane {
    position: absolute;
    height: 72px;
    background-color: $white;
    bottom: 0;
  }

  #post-run-html {
    margin: 0;
  }

  .template-images {
    ul {
      li {
        margin-bottom: 12px;
        padding-bottom: 12px;
        &:not(:last-child) {
          border-bottom: 1px solid $light_grey;
        }

        .template-image-icon {
          display: inline-block;
          background-color: $light_grey;
          width: 40px;
          height: 40px;
          margin-right: 6px;
          border-radius: 4px;
          img {
            margin: 10px 0 0 10px;
            width: 20px;
            height: 20px;
          }
        }

        .template-image-external {
          display: inline-block;
          border-left: 1px solid $medium_grey;
          margin-left: 12px;
          padding-left: 12px;
          line-height: 27px;
          a {
            &:first-child {
              margin-right: 14px;
            }
            &:hover {
              color: $dark_blue
            }
          }
        }
      }
    }
  }
}

.search-form {
  margin-bottom: 20px;

  input.query-field {
    @include border-box;
    width: 745px;
    margin-bottom: 5px;
  }

  button.button-primary {
    @include border-box;
    @extend .icon-magnifying-glass-for-button;
    float: right;
    width: 200px;
  }
}

.example-searches {
  padding: 1em 0;
  overflow: auto;

  h3 {
    color: $dark_grey;
    padding-bottom: 16px;
    border-bottom: 1px solid $medium_grey;
    margin-bottom: 16px;

    a {
      font-weight: normal;
      font-size: 0.8em;
    }
  }

  .toggler {
    padding-top: 6px;
    font-size: 0.8em;
    clear: both;
    display: block;

    span:last-child {
      display: inline;
    }
    span:first-child {
      display: none;
    }
  }

  &.collapsed {
    .toggler {
      span:last-child {
        display: none;
      }
      span:first-child {
        display: inline;
      }
    }
    .keyword-bank {
      height: 75px;
      overflow: hidden;
    }
  }

  a.keyword {
    @extend .button-minor;
    min-width: 0;
    float: left;
    margin: 0 5px 5px 0;
  }
}

.search-result-item {
  background-color: $light_grey;
  border: darken( $light_grey, 10% ) 1px solid;
  margin: 1em 0;

  &:after {
    content: '';
    width: 1px;
    height: 1px;
    clear: both;
    display: block;
  }

  .badge {
    float: left;
    width: 110px;
    height: 110px;
    text-align: center;
    line-height: 110px;
    background-color: $grey;
    color: $white;
    font-size: 0.9em;
    overflow: hidden;
  }

  .badge.local {
    background-color: $blue_grey
  }

  .badge.official {
    background-color: $blue_grey_dark;
  }

  .authority {
    float: left;
    width: 20px;
    padding-left: 10px;

    div {
      margin: 10px 0;
    }
  }

  .basic-info {
    float: left;
    margin: 10px 20px;
    width: 465px;
    @include border-box;
    height: 90px;
    overflow: hidden;

    h3 {
      margin-bottom: 0;
      color: $dark_grey;
      white-space: nowrap;
      overflow-x: hidden;
    }

    p {
      padding-bottom: 0.5em;
      font-size: 0.8em;
      line-height: 1.2;
    }
    .imagelayers-link {
      margin-left: 4px;
    }
  }

  .actions {
    float: right;
    min-height: 90px;
    border-left: darken( $light_grey, 10% ) 1px solid;
    padding: 0 20px;
    margin: 10px 0 0;

    label {
      font-size: 12px;
    }

    .chosen-container {
      width: 132px !important;
      .chosen-results {
        max-height: 55px; /* for now */
      }
    }

    .select-target-container {
      float: right;
      width: 165px;
      position: relative;
    }

    .select-target {
      @include border-radius(0.3em);
      @include border-box;
      width: 165px;
      position: absolute;
      margin: 10px 0 0;
      background: $orange;
      overflow:hidden;
      border-radius: 0.3em;
      padding: 10px 30px 11px;
      color: white;
      font-size: 14px;
      font-weight: bold;
      cursor: pointer;

      &.expanded {
        header:after {
          @extend .icon-thick-arrow-down;
          content: '';
          position: absolute;
          right: 10px;
          top: 12px;
          display: block;
          @include icon-white;
          width: 10px;
          height: 10px;
        }

        .target-options {
          padding-top: 20px;
          height: 50px;
        }
      }

      header {
        color: $white;
        font-size: 14px;

        &:after {
          content: '';
          position: absolute;
          right: 10px;
          top: 12px;
          display: block;
          @extend .icon-thick-arrow-right;
          @include icon-white;
          width: 10px;
          height: 10px;
        }
      }

      button.link {
        outline: none;
        border: none;
        background: none;
        color: $white;
        font-size: 13px;
        cursor: pointer;
        padding: 0;
        margin: 0;

        &:hover {
          text-decoration: underline;
        }
      }

      a {
        color: $white;
        text-decoration: none;
        font-size: 13px;
        font-weight: normal;

        &:hover {
          text-decoration: underline;
        }
      }

      .target-options {
        @include transition('height 0.5s, padding 0.5s');
        height: 0;
        text-align: left;
        overflow: hidden;

        li {
          padding: 5px 0;
        }
      }
    }

    .select-target.disabled {
      cursor: not-allowed;
    }

    .button-positive {
      @include border-box;
      padding-right: 30px;
      width: 165px;
      position: relative;
      margin: 10px 0 0;
      display: block;

      &:before {
        content: '';
        position: absolute;
        right: 10px;
        top: 14px;
        display: block;
        @extend .icon-thick-arrow-right;
        @include icon-white;
        width: 10px;
        height: 10px;
      }

      &[disabled],
      &[disabled]:hover {
        background-color: darken( $orange, 15% );
        color: $light_grey;
      }
    }

    select {
      display: block;
    }
  }
}

.search-result-item.image-result {
  .community-data {
    @extend .actions;

    a { text-decoration: none }

    .star-count {
      @include border-radius(3px);
      @include border-box;
      width: 80px;
      height: 40px;
      padding: 13px 0 0 40px;
      overflow: hidden;
      background-color: darken( $light_grey, 10% );
      position: relative;
      font-size: 0.9em;

      &:before {
        @extend .icon-star-large;
        content: '';
        display: block;
        position: absolute;
        left: 10px;
        top: 10px;
      }

      &:hover {
        background-color: $grey;
        color: $white;

        &:before {
          @include icon-white;
        }
      }
    }
  }
}

.search-result-item.absolute-image-result {
  background: $white;
  border: none;

  .badge {
    width: 80px;
    height: 80px;
    border-radius: 40px;
    margin: 15px;
    line-height: 80px;
  }

  .actions {
    border: none;
  }
}

.search-result-item.template-result {
  .community-data {
    @extend .actions;
    .image-count {
      @include border-radius(45px);
      @include border-box;
      background-color: darken($light_grey, 10%);
      width: 90px;
      height: 90px;
      padding-top: 20px;
      text-align: center;
      font-size: 13px;

      em {
        display: block;
        font-size: 36px;
        font-weight: bold;
        font-style: normal;
      }
    }
  }

  .badge {
    line-height: 1;

    div {
      @include border-box;
      @include border-radius(30px);
      margin: 18px 25px 5px;
      width: 60px;
      height: 60px;
      padding: 10px;
      background-color: $white;
    }

    img {
      width: 40px;
      height: 40px;
    }

    background-color: $blue_grey_dark;
  }
}

.search-result-item.in-progress {
  .basic-info p {
    margin-top: 35px;
  }

  .badge {
    background: url(<%= asset_data_uri 'loading_blocks.gif' %>) no-repeat center center;
  }
}

.search-result-item.no-results {
  .basic-info {
    padding-top: 30px;
    min-height: 90px;
    width: 700px;
    @include border-box;
  }

  .badge {
    background: asset-url('frowny_face.png') no-repeat center center;
  }
}

.search-result-item.source-repo-blurb {
  background-color: $blue_grey;
  .basic-info {
    padding-left: 5px;
    padding-top: 10px;
    height: 35px;
    width: 600px;
    @include border-box;
    color: $white;
  }

  .badge {
    width: 50px;
    height: 50px;
    background-color: $white;
    background: asset-url('icon_template_default_small.png') no-repeat center center;
  }

  .link-actions {
    font-size: 12px;
    float: right;
    height: 25px;
    padding: 10px 40px 0 20px;
    margin: 10px 10px 10px 0px;
    display: block;
    position: relative;

    &:after {
      content: '';
      position: absolute;
      right: 20px;
      top: 12px;
      display: block;
      @extend .icon-thick-arrow-right;
      @include icon-white;
      width: 10px;
      height: 10px;
    }

    a {
      color: $grey;

      &:hover {
        text-decoration: none;
      }
    }

  }
}

.search-title {
  display: none;
  margin: 0;
  padding-bottom: 0.4em;
}

.archetype {
  display: none;
}

// Search Form in modal window
#manage_flow .ui-dialog {
  input.query-field {
    width: 600px;
  }

  .filterable-list {
    .basic-info {
      width: 325px;
    }
  }

  .search-result-item.image-result {
    .community-data {
      padding: 0 15px;
    }
  }

  .search-result-item.template-result {
    .community-data {
      padding: 0 15px;
    }
  }
}

.chosen-container-active.chosen-with-drop .chosen-single {
  box-shadow: 1px 0 0px $white;
}

.blog-feed {
  float: left;
  width: 48%;
  margin-top: 30px;

  h3 {
    padding-bottom: 16px;
    border-bottom: 1px solid $medium_grey;
  }

  a.blog-link {
    @extend .button-secondary;
    padding: 1em;
    margin: 20px 0 0 0;
    font-size: 0.8em;
    font-weight: normal;
    text-decoration: none;
  }

  .blog-feed-items {

    li {
      padding: 0 0 20px 0;
      border-bottom: 1px solid $light_grey;
      margin: 20px 0 0 0;
      font-size: 1.1em;

      .timestamp {
        display: inline-block;
        width: 34%;
        margin-right: 2%;
        padding: 0;
        vertical-align: top;
        color: $medium_grey;
        font-weight: 200;
      }

      a {
        display: inline-block;
        width: 61%;
        padding: 0;
        margin: 0;
        font-weight: bold;
        color: $blue_grey;
        text-decoration: none;

        &:hover {
          color: $blue_grey_dark;
          text-decoration: underline;
        }
      }
    }
  }
}

.compose-banner {
  width: 48%;
  float: right;
  margin-bottom: 50px;
  margin-top: 30px;
}
